package com.hddz.acquisition.view;

import java.util.List;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;

public class MapItemPageAdaper extends PagerAdapter {

	private List<View> views;
	private Context context;

	public MapItemPageAdaper(Context context, List<View> views) {
		this.context = context;
		this.views = views;
	}

	@Override
	public int getCount() {
		return Integer.MAX_VALUE;
	}

	@Override
	public boolean isViewFromObject(View view, Object object) {
		return (view == object);
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		((ViewPager) container).addView(views.get(position % views.size()), 0);
		return views.get(position % views.size());
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		((ViewPager) container).removeView(views.get(position % views.size()));
	}
}
